package com.dkd.handler;

import cn.elegent.ac.ACHandler;
import cn.elegent.ac.annotation.Topic;
import com.dkd.config.TopicConfig;
import com.dkd.contract.SupplyContract;
import com.dkd.service.VendingMachineService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 补货消息处理
 */
@Topic(TopicConfig.VMS_SUPPLY_TOPIC)
public class SupplyMsgHandler  implements ACHandler<SupplyContract> {

    @Autowired
    private VendingMachineService vmService;

    @Override
    public void process(String topic,SupplyContract supplyContract) throws Exception {
        //更新售货机库存
        vmService.supply(supplyContract);
    }
}